package com.lyb.controller;

import com.lyb.common.AjaxResult;
import com.lyb.pojo.Borrow;
import com.lyb.services.impl.BorrowServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/borrow")
public class BorrowC {
    @Autowired
    BorrowServiceImpl borrowService;
    @GetMapping("/queryPage")
    public AjaxResult queryPage(Integer pageSize, Integer pageNum){
        return AjaxResult.success(borrowService.queryPage(pageSize,pageNum));
    }
    @DeleteMapping("/del")
    public AjaxResult del(Long id){
        borrowService.del(id);
        return AjaxResult.success("操作成功");
    }
    @PostMapping("/update")
    public AjaxResult update(@RequestBody Borrow borrow){
        borrowService.update(borrow);
        return AjaxResult.success("操作成功");

    }
    @PostMapping("/add")
    public AjaxResult add(@RequestBody Borrow borrow){
        borrowService.add(borrow);
        return AjaxResult.success("操作成功");

    }
}
